﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Deal.ascx.cs" Inherits="Front_UserControl_Deal" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Src="~/UserControl/CountDown.ascx" TagPrefix="uc1" TagName="countdown" %>
<%@ Register Src="~/UserControl/Gmap.ascx" TagName="Googlemap" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="GMaps" Namespace="Subgurim.Controles" TagPrefix="cc1" %>

<script type="text/javascript">


    var seconds = "";
    setInterval(fun1, 1000);

    function fun1() {
        if (seconds == "")
            seconds = document.getElementById('<%=hdnseconds.ClientID %>').value;


        var days = Math.floor((parseInt(seconds) / (60 * 60 * 24)));
        var temp = Math.floor((parseInt(seconds) - (60 * 60 * 24 * parseInt(days))));
        var hours = Math.floor((parseInt(temp) / (60 * 60)));
        temp = Math.floor((parseInt(temp) - (60 * 60 * parseInt(hours))));
        var minitue = Math.floor((parseInt(temp) / (60)));
        temp = Math.floor((parseInt(temp) - ((60) * minitue)));



        document.getElementById("days").innerHTML = days;
        document.getElementById("hours").innerHTML = hours;
        document.getElementById("minitues").innerHTML = minitue;
        document.getElementById("seconds").innerHTML = temp;
        seconds = parseInt(seconds) - 1;


    }

    function Foo() {
        $find('DailyEMailpopUp').show();
        return false;
    }
    function CloseGiftWindow() {
        $find('DailyEMailpopUp').hide();
        return false;
    }

    function popUpblock() {

        $find('divSubcrigePopUp').hide();
        MyWS.SubscribePopUpBlock("1", OnComplete);
        return false;
    }
    function OnComplete(args) {
        return true;
    }
</script>

<table id="main-body">
    <tbody>
        <tr>
            <td class="content">
                <div class="box-outer">
                    <div class="share-links">
                        Share this deal: <a href="" class="facebook" title="Share this deal with Facebook"
                            id="FaceBook" runat="server" target="_blank">Facebook</a> <a href="" class="twitter"
                                title="Share this deal with Twitter" id="Twiteer" runat="server" target="_blank">
                                Twitter</a> <a href="" class="email" title="Share this deal with your Email" onclick="return Foo();">
                                    Email</a>
                    </div>
                    <div class="dealbox main box">
                        <div class="dealtitle">
                            <span class="todays-deal">Today's Deal:</span> </asp:Label><asp:Label ID="lblDealTitle"
                                runat="server" Text=""></asp:Label></div>
                        <table>
                            <tbody>
                                <tr>
                                    <td class="left">
                                        <div class="buybox">
                                            <div class="buy" style="position: relative;">
                                                <asp:Label ID="lblRegularPrice" runat="server" Text="$25" CssClass="cost"></asp:Label>
                                                <asp:ImageButton ID="ImageButton1" runat="server" CssClass="buy_but" ImageUrl="../Images/buy_but.png"
                                                    OnClick="ImageButton1_Click" Visible="true" />
                                                <asp:Image ID="ImageButton2" runat="server" ImageUrl="~/Images/sold_out.png" Visible="false" />
                                            </div>
                                            <table style="padding: 1px 0px;" class="numbers">
                                                <tbody>
                                                    <tr>
                                                        <td class="price">
                                                            <asp:Label ID="lblValue" runat="server"></asp:Label>
                                                        </td>
                                                        <td class="x">
                                                            &nbsp;
                                                        </td>
                                                        <td class="discount">
                                                            <asp:Label ID="lblDiscount" runat="server"></asp:Label>
                                                        </td>
                                                        <td class="eq">
                                                            &nbsp;
                                                        </td>
                                                        <td class="save">
                                                            <asp:Label ID="lblSave" runat="server"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Value
                                                        </td>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            Discount
                                                        </td>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            Savings
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="countdown" id="timeCountDown" runat="server" visible="true">
                                            <div class="title">
                                                Time Left to Buy</div>
                                            <div class="cont">
                                                <div id="days">
                                                </div>
                                                <div id="hours">
                                                </div>
                                                <div id="minitues">
                                                </div>
                                                <div id="seconds">
                                                </div>
                                                <input type="hidden" runat="server" id="hdnseconds" value="0" /></div>
                                        </div>
                                        <div style="clear: left; text-align: center; font-weight: bold; color: #003333; height: 25px;
                                            margin: 10px 0 0 50px; font-size: 15px; text-align: center; float: left; width: 100px;">
                                            <asp:Label ID="TotalPurchaseQty" runat="server" Text=""></asp:Label></div>
                                    </td>
                                    <td class="right">
                                        <div class="mainimg">
                                            <asp:Image ID="DealImg" Height="299" Width="430" runat="server" ImageUrl="../images/product.jpg" />
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <table>
                            <tbody>
                                <tr>
                                    <td class="footprint">
                                        <h3>
                                            Keep In Mind</h3>
                                        <asp:Label ID="txtFootPrint" runat="server" Text=""></asp:Label>
                                    </td>
                                    <td class="highlight">
                                        <h3>
                                            Did You Know?</h3>
                                        <asp:Label ID="lblHighlights" runat="server" Text=""></asp:Label>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-inner">
                    </div>
                </div>
                <div class="companybox-outer">
                    <div class="companybox-inner">
                        <div id="companybox">
                            <table class="main">
                                <tbody>
                                    <tr>
                                        <td class="short">
                                            <span class="large">
                                                <div class="black">
                                                    Company Info:
                                                </div>
                                            </span>
                                            <asp:Label ID="lblVendor" runat="server" Text=""></asp:Label><br>
                                            <a href="" id="website" target="_blank" runat="server">
                                                <asp:Label ID="lblWebSite1" runat="server" Text="Website"></asp:Label></a>
                                            <br />
                                            <a href='#' id="lnkGoogleMap" target="_blank" runat="server">
                                                <asp:Label ID="lblGoogleMap" runat="server" Text="Map It!" ForeColor="Red"></asp:Label>
                                            </a>
                                            <br />
                                            <br />
                                            <div style="cursor: pointer;">
                                                <uc1:Googlemap ID="ucGoogleMap" runat="server" />
                                            </div>
                                            <br />
                                            <br />
                                            <div class="black" id="Locations" runat="server" visible="False">
                                                <b>Location(s):</b>
                                            </div>
                                            <div>
                                                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                    <ContentTemplate>
                                                        <telerik:RadListView ID="RadAddressBox" runat="server" ItemPlaceholderID="ListViewContainer"
                                                            Skin="Telerik" SkinID="Telerik" DataKeyNames="Address1,Address2,City,State,ZipCode,DealID"
                                                            OnItemDataBound="RadAddressBox_ItemDataBound1">
                                                            <LayoutTemplate>
                                                                <asp:PlaceHolder runat="server" ID="ListViewContainer" />
                                                            </LayoutTemplate>
                                                            <ItemTemplate>
                                                                <fieldset class="loc_link">
                                                                    <div style="word-wrap: break-word;">
                                                                        <%-- <asp:Label ID="Name" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
                                                                        <asp:Label ID="Address1" runat="server" Text='<%#Eval("Address1")%>'></asp:Label>
                                                                        <asp:Label ID="Address2" runat="server" Text='<%#Eval("Address2")%>'></asp:Label><br />
                                                                        <asp:Label ID="City" runat="server" Text='<%#Eval("City")%>'></asp:Label>
                                                                        <asp:Label ID="State" runat="server" Text='<%#Eval("State")%>'></asp:Label>
                                                                        <asp:Label ID="ZipCode" runat="server" Text='<%#Eval("ZipCode")%>'></asp:Label><br />
                                                                        <asp:Label ID="PhoneNo" runat="server" Text='<%#Eval("PhoneNo")%>'></asp:Label><br />
                                                                        <a href='<%#"https://" + Eval("WebSite")%>' id="website" target="_blank" runat="server">
                                                                            <asp:Label ID="lblWebSite" runat="server" Text='<%#Eval("WebSite")%>'></asp:Label></a>--%><table>
                                                                                <tr>
                                                                                    <td>
                                                                                        <asp:Label ID="Name" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <asp:Label ID="Address1" runat="server" Text='<%#Eval("Address1")%>'></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <asp:Label ID="Address2" runat="server" Text='<%#Eval("Address2")%>'></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <asp:Label ID="City" runat="server" Text='<%#Eval("City")%>'></asp:Label>
                                                                                        <asp:Label ID="State" runat="server" Text='<%#Eval("State")%>'></asp:Label>
                                                                                        <asp:Label ID="ZipCode" runat="server" Text='<%#Eval("ZipCode")%>'></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <asp:Label ID="PhoneNo" runat="server" Text='<%#Eval("PhoneNo")%>'></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <a href='<%#"https://" + Eval("WebSite")%>' id="website" target="_blank" runat="server">
                                                                                            <asp:Label ID="lblWebSite" runat="server" Text='<%#Eval("WebSite")%>'></asp:Label></a>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        <br />
                                                                        <a href='<%#"https://maps.google.com/maps?q=" + TrimDescription(Eval("Address1")as string,Eval("City") as string,Eval("State") as string,Eval("ZipCode") as string)%>'
                                                                            id="A1" target="_blank" runat="server">
                                                                            <asp:Label ID="Label1" runat="server" Text="Map It!" ForeColor="Red"></asp:Label>
                                                                        </a>
                                                                        <br />
                                                                        <br />
                                                                        <div style="cursor: pointer;">
                                                                            <uc1:Googlemap ID="Googlemap1" runat="server" _Address1='<%#Eval("Address1")%>' _City='<%#Eval("City")%>'
                                                                                _State='<%#Eval("State")%>' _GID='<%#Eval("DealAddressID")%>' />
                                                                        </div>
                                                                        <br>
                                                                        ----------------------
                                                                    </div>
                                                                </fieldset>
                                                            </ItemTemplate>
                                                        </telerik:RadListView>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </div>
                                        </td>
                                        <td class="description">
                                            <span class="title">Description:</span>
                                            <br>
                                            <p>
                                                <asp:Label ID="lblDescription" runat="server"></asp:Label></p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </tbody>
</table>
<asp:LinkButton ID="lnkbtnEmail" runat="server" Style="display: none">View more Cities</asp:LinkButton>
<asp:Panel ID="EmailPopUp" runat="server" Style="border: 2px solid #87ae53; width: 300px;
    height: 390px; background-color: #ddedcc; font-family: Arial; display: none;"
    EnableViewState="True">
    <div style="float: right; margin-top: -10px; right: -25px; top: 0;">
        <asp:ImageButton ID="ImageButton3" runat="server" Width="20px" Height="20px" ImageUrl="~/Images/cross.png"
            OnClientClick="return CloseGiftWindow();" /></div>
    <div style="height: 40px; background-color: #ddedcc; padding-top: 10px; margin-left: 15px;">
        <table>
            <tr>
                <td>
                    <b>Email to a Friend:</b><br />
                    <br />
                    
                </td>
            </tr>
            <tr>
                <td>
                    <b>To:</b> (email address)<br />
                    <asp:TextBox ID="txtTo" runat="server" Width="250px" TextMode="MultiLine" Rows="2"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtTo"
                        ErrorMessage="To is required." ToolTip="To is required." ValidationGroup="Email">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtTo"
                        ErrorMessage="You must enter an valid email address" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ValidationGroup="Email">*
                    </asp:RegularExpressionValidator><br />
                </td>
            </tr>
             <tr >
                <td>
                  <div style="padding-bottom:5px">Up to 5 recipients.</div>
                </td>
            </tr>
            <tr style="margin-top: 5px">
                <td>
                    <b>From:</b> (email address)<br />
                    <asp:TextBox ID="txtFrom" runat="server" Width="250px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFrom"
                        ErrorMessage="From is required." ToolTip="To is required." ValidationGroup="Email">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtFrom"
                        ErrorMessage="You must enter an valid email address" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ValidationGroup="Email">*
                    </asp:RegularExpressionValidator><br />
                </td>
            </tr>
      <%--      <tr>
                <td>
                    <b>Subject:</b><br />
                    <asp:TextBox ID="txtSubject" runat="server" Width="250px" TextMode="MultiLine"></asp:TextBox><br />
                </td>
            </tr>--%>
            <tr  style="margin-top: 5px">
                <td>
                    <b>Message:</b><br />
                    <asp:TextBox ID="txtMessage" runat="server" Width="250px" TextMode="MultiLine" Height="120px" MaxLength="255"></asp:TextBox><br />
                </td>
            </tr>
              <tr  style="margin-top: 5px">
                <td>
                   255 characters limit.
                </td>
            </tr>
            <tr  style="margin-top: 5px">
                <td>
                    <br />
                    <asp:Button ID="btnGiftSave" runat="server" Text="Send" ValidationGroup="Email" OnClick="btnGiftSave_Click"
                        class="ui-state-default ui-corner-all" />
                    <asp:Button ID="btnCacel" runat="server" Text="Cancel" OnClientClick="return CloseGiftWindow();"
                        CausesValidation="false" class="ui-state-default ui-corner-all" />
                </td>
            </tr>
        </table>
    </div>
    <div align="center">
        <asp:Button ID="OkbtnEmail" runat="server" Text="OK" Style="display: none" CausesValidation="false" />
        <asp:Button ID="CancelbtnEmail" runat="server" Style="display: none" Text="Close" />
    </div>
</asp:Panel>
<cc1:ModalPopupExtender ID="DailyEMailpopUp" runat="server" TargetControlID="lnkbtnEmail"
    PopupControlID="EmailPopUp" BehaviorID="DailyEMailpopUp" DropShadow="true" CancelControlID="CancelbtnEmail"
    BackgroundCssClass="modalBackground" />
<asp:LinkButton ID="lnkMore1" runat="server" Style="display: none">View more Cities</asp:LinkButton>
<asp:Panel ID="PanelSubscriptionPopup1" runat="server" Style="border: 2px solid #87ae53;
    width: 600px; height: 100px; background-color: #fff; font-family: Arial; display: none;"
    EnableViewState="True">
    <div style="float: right; margin-top: -10px; right: -25px; top: 0;">
        <asp:ImageButton ID="imgClose" runat="server" Width="20px" Height="20px" ImageUrl="~/Images/cross.png"
            OnClientClick="return popUpblock();" /></div>
    <div style="height: 40px; background-color: #ddedcc; padding-top: 10px;">
        <h1 style="text-align: center; font-size: 25px; color: #303030; margin: 0px 0 0 20px;">
            <asp:Label ID="SubcribedCity" runat="server" Text=""></asp:Label>
        </h1>
    </div>
    <div>
        <h4 style="text-align: center; font-size: 18px; color: #303030; margin: 10px 0 0 0;">
            You are now subscribed to receive our daily emails.</h4>
    </div>
    <div align="center">
        <asp:Button ID="OkButton1" runat="server" Text="OK" Style="display: none" CausesValidation="false" />
        <asp:Button ID="CancelButton1" runat="server" Style="display: none" Text="Close" />
    </div>
</asp:Panel>
<cc1:ModalPopupExtender ID="divSubcrigePopUp" runat="server" TargetControlID="lnkMore1"
    PopupControlID="PanelSubscriptionPopup1" BehaviorID="divSubcrigePopUp" DropShadow="true"
    CancelControlID="CancelButton1" BackgroundCssClass="modalBackground" />
